import 'reflect-metadata'
import { NestFactory } from '@nestjs/core'
import { AppModule } from './module/app.module'
import { ValidationPipe } from '@nestjs/common'
import logger from '../core/logger'
// 启动内部服务
export async function ServerBootstrap() {
  logger.debug('启动内部服务')
  const app = await NestFactory.create(AppModule)

  logger.debug('启动验证规则')
  app.useGlobalPipes(new ValidationPipe())

  const port = process.env.PORT ?? 3000
  logger.info(`启动端口为: ${port}`)
  await app.listen(port)
}
